#ifndef QQTVIRTUALLONGDATAMANAGER_H
#define QQTVIRTUALLONGDATAMANAGER_H

#include <QObject>

#include <qqtdictionary.h>
#include <qqtudpclient.h>
#include <qqtlongdataprotocol.h>

#include <qqtframe.h>

#include <qqthighgrade_global.h>
/**
 * @brief The QQtVirtuallongDataManager class
 * LibQQt提供的虚拟接口的网络长数据管理者
 * CLIENT
 */
class QQTHIGHGRADESHARED_EXPORT QQtVirtualLongDataManager : public QObject
{
    Q_OBJECT

public:
    explicit QQtVirtualLongDataManager ( QObject* parent = 0 );
    virtual ~QQtVirtualLongDataManager();

    //!1 子类一般会用来设置handler和使用handler。
    void setClientHandler ( QQtUdpClient* handler );
    QQtUdpClient* handler();

    //设置远端服务器IP、端口
    void setServerAddress ( QHostAddress address, int port = 4419 );
    void setServerPort ( int port = 4419 );

    //客户端要接收数据必须bind端口
    void setListeningAddress ( QHostAddress address, int port = 4420 );
    void setListeningPort ( int port = 4420 );

    //!2
    void setProtocolHandler ( QQtLongDataProtocol* protocol );
    QQtLongDataProtocol* protocol();

    void sendMessage ( const QQtLongDataSerialization& data );

signals:
    void readyRead ( const QQtLongDataSerialization& data );

protected:

protected slots:

protected:

private:
    QQtUdpClient* c0;
    QQtLongDataProtocol* p0;
};

#endif // QQTVIRTUALLONGDATAMANAGER_H

